import { createRouter, createWebHistory } from 'vue-router'
import index from '../views/index.vue'
import business from '../views/business.vue'
import footer from '../components/footer.vue'
import businessInfo from '../views/businessInfo.vue'
import order from '../views/order.vue'
import payment from '../views/payment.vue'
import orderList from '../views/orderList.vue'
import login from '../views/login.vue'
import register from '../views/register.vue'
import userAddress from '../views/userAddress.vue'
import addUserAddress from '../views/addUserAddress.vue'
import editUserAddress from '../views/editUserAddress.vue'

const routes = [
  {
    path: '/',
    redirect: '/index',
  },
  {
    path:'/index',
    component: index, // 渲染 index 组件
  },
  {
    path:'/business',
    component: business,
  },
  {
    path:'/footer',
    component: footer,
  },
  {
    path:'/businessInfo',
    component: businessInfo,
  },
  {
    path:'/order',
    component: order,
  },
  {
    path:'/payment',
    component: payment,
  },
  {
    path:'/orderList',
    component: orderList,
  },
  {
    path:'/login',
    component: login,
  },
  {
    path:'/register',
    component: register,
  },
  {
    path:'/userAddress',
    component: userAddress,
  },
  {
    path:'/addUserAddress',
    component: addUserAddress,
  },
  {
    path:'/editUserAddress',
    component: editUserAddress,
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
